<template>
    <div style="height: 37.125rem">
      <el-amap :center="center" >
        <el-amap-marker :position="center" :label="label"></el-amap-marker>
      </el-amap>
    </div>
  </template>
  <script>
  export default {
    props:{
        list:{
            type:Array
        }
    },
    name: "map2",
    data() {
      return {
        // 父传子的值
        DataList:this.list,
        // 地址
        address:'',
        // 地图数据
        center: [113.23, 23.16],//中心坐标的经纬度
        zoom: 15,//地图的缩放等级
        label: {
          content: this.address,
          offset: [-10, -20],
        },
      };
    },
    created(){
        this.address = this.DataList[0].address.split(',')[2]
    }
  };
  </script>
  <style scoped>
  div {
    width: 400px;
    height: 300px;
  }
</style>